<template>
	<view class="no">
		<view class="no-title">
			<text>{{detail.title}}</text>
			<text>时间：{{time}}</text>
		</view>
		<view class="content" v-html="content">
			
		</view>
	</view>
</template>

<script>
	import {noticedetail} from '@/common/index.js';
	import {formatDate} from '@/static/js/utils.js';
	export default {
		data() {
			return {
				id:'',
				content:'',
				detail:{},
				time:''
			};
		},
		onLoad(ops) {
			this.id = ops.id;
			this.noticedetail()
		},
		methods:{
			noticedetail(){
				noticedetail({id:this.id}).then(res=>{
					if(res.code == 1){
						// console.log(res)
						this.detail = res.msg;
						let content = res.msg.content;
						const regex = new RegExp('<img', 'gi');
						content= content.replace(regex, '<img style="max-width: 100%;display:none;"');
						this.content = content;
						let time = formatDate(res.msg.create_time*1000)
						this.time = time;
					}else{
						
					}
				}).catch()
			},
		}
	}
</script>
<style>
	page{
		background-color: #FFFFFF;
	}
</style>
<style lang="less">
	.no-title{
		text{
			display: block;
			text-align: center;
			&:first-child{
			   font-size:34upx;
			   padding: 10px 0;	
			   color: #333333;
			}
			font-size: 20upx;
			color: #666666;
		}
	}
	.content{
		font-size: 28upx;
		color: #333333;
		padding: 20upx;
		line-height:54upx;
	}
</style>
